package com.example.mvpdemo.base;

import android.content.Context;

public class BasePresenter<T extends BaseView> {
    protected T mView;
    protected Context mContext;

    /**
     * 绑定view
     *
     * @param view view
     */
    public void attachView(T view) {
        this.mView = view;
    }

    /**
     * 解除绑定view
     */
    public void detachView() {
        this.mView = null;
    }

    /**
     * View是否绑定
     *
     * @return true绑定 false未绑定
     */
    public boolean isViewAttached() {
        return mView != null;
    }


    /***
     * 绑定context
     * @param context
     */
    public void addContext(Context context) {
        this.mContext = context;
    }
}
